;; import data-structures/print-tree.scm
(define (node l v r) (lambda (q) (q l v r)))

(define t1
  (node (node (node (node #f 4 #f) 3 #f)
              2
              #f)
        1
        (node (node (node #f 6 #f) 6 #f)
              6
              (node #f 7 (node #f 8 #f)))))

(define (reflect node)
  (lambda (branch leaf)
    (if node
        (node branch)
        (leaf #f))))

(define print-tree (make-tree-printer reflect))

(print-tree t1)
(newline)
